import request from '@/utils/swagger'

export function getTradeMark(pageSize, pageNum) {
  return request({
    url: `/admin/product/baseTrademark/${pageNum}/${pageSize}`,
    method: 'get',
  })
}

export function saveOrUpdateTrademark(tradeForm) {
  if (tradeForm.id) {
    //修改
    return request({
      url: `/admin/product/baseTrademark/update`,
      method: 'put',
      data: tradeForm
    })
  } else {
    //新增
    return request({
      url: `/admin/product/baseTrademark/save`,
      method: 'post',
      data: tradeForm
    })
  }
}

export function deleteTrademark(id) {
  return request({
    url: `/admin/product/baseTrademark/remove/${id}`,
    method: 'delete',
  })
}

export function getCategory1List() {
  return request({
    url: `/admin/product/getCategory1`,
    method: 'get',
  })
}

export function getCategory2List(category1Id) {
  return request({
    url: `/admin/product/getCategory2/${category1Id}`,
    method: 'get',
  })
}

export function getCategory3List(category2Id) {
  return request({
    url: `/admin/product/getCategory3/${category2Id}`,
    method: 'get',
  })
}

export function getAttrList(category1Id,category2Id,category3Id) {
  return request({
    url: `/admin/product/attrInfoList/${category1Id}/${category2Id}/${category3Id}`,
    method: 'get',
  })
}

export function deleteAttr(attrId) {
  return request({
    url: `/admin/product/deleteAttr/${attrId}`,
    method: 'delete',
  })
}

export function saveAttr(param) {
  return request({
    url: `/admin/product/saveAttrInfo`,
    method: 'post',
    data: param
  })
}


